<?php

include('../../common.php');
if($_SESSION['log_islogin'] == 'yes' ){
	

	//Get driver available
	$qList= "SELECT *
				FROM person
				WHERE 1 = 1
					AND per_job_code = 'DVR'
					AND per_id NOT IN(SELECT
										p.per_id
									  FROM person p,
										person_transport_delivering ptd
									  WHERE p.per_id = ptd.ptd_person_per_id
										  AND ptd.ptd_date_assign_driver = DATE_FORMAT(NOW(),'%y-%m-%d'))";
	$rList = $db->sql_fetch($qList);
	
	$initvalue="[";
	$contentvalue="";
	foreach ($rList as $i) {
		$selected ="";
		if($subid != "" && $subid != null && $i['id']==$subid){
			$selected ="SELECTED";
		}
		$contentvalue = $contentvalue.'{"optionValue": "'.$i['per_id'].'","optionSelected": "'.$selected.'", "optionDisplay": "'.$i['per_full_name'].'"},';
	}
	$contentvalue = substr($contentvalue,0,-1); 
	echo $initvalue.$contentvalue.']';	
											
}else{
	echo 'Dude!';
}

?>
